package com.example.getaudit.common.genutil;


import com.example.getaudit.config.mybatisPlus.MbpGeneratorConfig;
import org.springframework.beans.factory.annotation.Value;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @author wnhyang
 * @date 2024/3/15
 **/
public class Generator {

    /**
     * 数据源
     */
    @Value("${datasource.url}")
    private String url;
    private static final String JDBC_URL = "jdbc:mysql://172.20.0.183:3306"; // /getaudit?serverTimezone=Asia/Shanghai&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=UTC

    /**
     * 数据库名
     */
    private static final String DATABASE = "commodity_market_price";

    /**
     * 驱动类名
     */
    private static final String DRIVER_CLASS_NAME = "com.mysql.cj.jdbc.Driver";

    /**
     * 用户名
     */
    private static final String USERNAME = "root";

    /**
     * 密码
     */
    private static final String PASSWORD = "HQQ.aini.01";

    /**
     * 父包名
     */
    private static final String PARENT = "com.example.getaudit";

    /**
     * 模块名
     */
    private static final String MODULE_NAME = "";

    /**
     * 表名
     */
    private static List<String> TABLES = new ArrayList<>();

    /**
     * 表前缀
     */
    private static final String TABLE_PREFIX = "";

    /**
     * 作者
     */
    private static final String AUTHOR = "";


    public static void main(String[] args) {


        TABLES = Arrays.asList("commodity_market_price_monthly");


        MbpGeneratorConfig config = new MbpGeneratorConfig();
        config.setDriverClassName(DRIVER_CLASS_NAME);
        config.setJdbcUrl(JDBC_URL);
        config.setUsername(USERNAME);
        config.setPassword(PASSWORD);
        config.setDatabase(DATABASE);
        config.setTableNames(TABLES);
        config.setTablePrefix(TABLE_PREFIX);
        config.setParent(PARENT);
        config.setModuleName(MODULE_NAME);
        config.setAuthor(AUTHOR);
        MbpGeneratorUtil.generate(config);
    }
}
